package com.itheima;

import com.itheima.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 *
 */
public class App {
    public static void main( String[] args ) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
//        1.根据ID获取
//        BookDao bookDao = (BookDao) ac.getBean("bookDao");
//        2.根据name和指定的类获取
//        BookDao bookDao = ac.getBean("bookDao", BookDao.class);
//        3.这是根据指定的类获取
        BookDao bookDao = ac.getBean(BookDao.class);
        bookDao.save();
    }
}
